package com.lsy.onehot.rnn.qa;

import com.lsy.onehot.rnn.qa.inner.ICurpusMateSet;

/**
 */
public class MultiLayerNetworkMateVector {
	private ICurpusMateSet mate;
	public void setICurpusMateSet(ICurpusMateSet mate){
		this.mate = mate;
	}
	public String getMatrixString(String text) {
		StringBuilder str = new StringBuilder();
		// 将句子文字映射到字向量中
		int[] vector = new int[mate.getListChar().size()];
		char[] s = text.toCharArray();
		for (char c : s) {
			int index = mate.getListChar().indexOf(c);
			if (index != -1)
				vector[index] = 1;
		}
		for (int n : vector) {
			str.append(n).append(",");
		}
		str = new StringBuilder(str.substring(0, str.length() - 1));
		return str.toString();
	}
}
